﻿<?php TPL::output('global/header.tpl.htm'); ?>

<div class="bd">
	<div class="tommy_rightDiv">
		<ul id="i_tabs" class="i_lsitecontents cl" style="border:none;position:fixed">
			<li <?php if (!$_GET['category']) { ?> class="cur"<?php } ?>>
				<a href="topic/<?php echo $_GET['act']; ?>/">全部话题</a></li>
		    <?php if(is_array($this->content_category)) { ?>
		    <?php foreach ($this->content_category as $key => $val) { ?>			
				<li<?php if ($_GET['category'] AND ($val['id'] == $this->category_info['id'])) { ?> class="cur"<?php } ?>><a href="topic/<?php echo $_GET['act']; ?>/category-<?php echo $val['id'];?>" onclick="if ($('a[name=category_<?php echo $val['id'];?>]').val('name')) { $.scrollTo(($('a[name=category_<?php echo $val['id'];?>]').offset()['top'] - 10), 600, {queue:true}); return false; }"><?php echo $val['title']; ?></a></li>
			<?php } ?>
			<?php } ?>
		</ul>
  </div>

  <div class="contant_left readns_discus default_topic_piazza">
    <h2 class="c_title">
      <p id="default_topic_tab" class="sux"><a href="topic/hot/<?php if ($_GET['category']){ ?>category-<?php echo $_GET['category'];?><?php } ?>" <?php if ($_GET['act'] == 'hot' || $_GET['act'] == 'index') { ?> class="cur"<?php } ?>>热门</a> •  <a href="topic/category/" <?php if ($_GET['act'] == 'category') { ?> class="cur"<?php } ?>>全部</a></p><img style="vertical-align:middle;margin-right:5px;" src="<?php echo G_STATIC_URL; ?>/css/default/img/topic.png"/>话题广场</h2>



<div class="gb_class" id="hot_tags"  style="padding-top:20px;">

 <?php foreach ($this->content_category as $ckey => $cval) { ?>  

<div class="default_rx">
<a name="category_<?php echo $cval['id'];?>"></a>
      	
      	  <h2 class="md_class"><img alt="" title="<?php echo $val['title']; ?>" src="<?php echo $cval['icon'];?>"  class="gb_img"><?php echo $cval['title']; ?></h2>
      	<div class="gb_class" id="hot_tags">
		<ul class="gb_lister">
			
			<?php if($cval['topics']){?>
			<?php foreach($cval['topics'] AS $key => $val) { ?>
				<li><div class="user_topic"><a href="topic/<?php echo $val['topic_title'];?>"><img alt="<?php echo $val['topic_title'];?>" class="imgs_user"   src="<?php if($val['topic_pic']){?><?php echo get_setting('upload_url').'/topic/'.
str_replace(AWS_APP::config()->get('image')->topic_thumbnail['min']['w'].'_'.AWS_APP::config()->get('image')->topic_thumbnail['min']['h'], AWS_APP::config()->get('image')->topic_thumbnail['mid']['w'].'_'.AWS_APP::config()->get('image')->topic_thumbnail['mid']['h'], $val['topic_pic']);?><?php } else { ?><?php echo G_STATIC_URL; ?>/common/topic-mid-img.jpg<?php } ?>"></a><p class="gb_top_list"><a href="topic/<?php echo $val['topic_title'];?>"><?php echo $val['topic_title'];?></a></p><p>问题数：<em><?php echo $val['discuss_count'];?></em> &nbsp;&nbsp;关注数：<em><?php echo $val['focus_count'];?></em></p></div>
				<p style="min-height:40px;"><?php echo cjk_substr($val['topic_description'], 0, 40, 'UTF-8', '...'); ?></p>
				
				<p class="gb_attention">
<span class="span <?php if ($val['has_focus']) { ?>cur<?php }?>" title="关注" onclick="focus_topic($(this), $(this), <?php echo $val['topic_id']; ?>);; return false;" href="javascript:void(0);"><?php if ($val['has_focus']) { ?>取消<?php } ?>关注</span>
               <?php if($val['best_answer']){ ?>
				擅长者：
				<?php foreach($val['best_answer'] AS $bkey=>$bval){ ?>
					<a  href="people/<?php echo $bval['user_name']; ?>" class="a"><img src="<?php echo get_avatar_url($bval['uid'],'mid',$bval['avatar_file']); ?>" onmouseover="eventsMouseM(this);" rel="<?php echo $bval['uid']; ?>"  alt="<?php echo $bval['user_name']; ?>"/></a>
				<?php }?>
				<?php }else{?>
				擅长者：
				<?php } ?>
				</p>
                </li>
			<?php } ?>
			<?php } ?>
            </ul>
			</div>			
		</div>
		<?php } ?>
  </div>
</div>

<script type="text/javascript">
var i_tabs = $('#i_tabs a');
$(i_tabs).each(function(index, element) {
    $(this).click(function(){
		if(index == 0){
			$('#i_tabs').css('position','static');
		}else{
			$('#i_tabs').css('position','fixed');
		}	
	})
});
</script>

<?php TPL::output('global/footer.tpl.htm'); ?>
